package com.uade.wcg.backend;

import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.routing.Router;

import com.uade.wcf.backend.domain.resources.GroupResource;
import com.uade.wcf.backend.domain.resources.PlayerResource;

public class WorldCupGlassBackendServlet extends Application {
	/**
	 * Creates a root Restlet that will receive all incoming calls.
	 */
	@Override
	public synchronized Restlet createInboundRoot() {
		// Create a router Restlet that routes each call to a new Resource
		Router router = new Router(getContext());
		
		//router.attachDefault(TestJsonResource.class);
		//Get all Groups
		router.attach("/worldcupglassbackend/groups", PlayerResource.class);
		
		//Get a Group
		router.attach("/worldcupglassbackend/groups/{group}", GroupResource.class);
		
		//Get a Player by lastName
		router.attach("/worldcupglassbackend/players/{playerLastName}", PlayerResource.class);
	    
		return router;
	}
}
